package Week5.J0517;

import java.util.Scanner;

public class 排序子序列_xv {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        int i = 0, ret = 0;
        while (i < n) {
            if (i == n - 1) {
                ret++;
                break;
            }
            if (arr[i] < arr[i + 1]) {
                while (i + 1 < n && arr[i] <= arr[i + 1]) {
                    i++;
                }
                ret++;
            } else if (arr[i] > arr[i + 1]) {
                while (i + 1 < n && arr[i] >= arr[i + 1]) {
                    i++;
                }
                ret++;
            } else {
                while (i + 1 < n && arr[i] == arr[i + 1]) {
                    i++;
                }
            }
            i++;
        }
        System.out.println(ret);
    }
}
